import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import {ActivatedRoute,Router} from '@angular/router'
import { ClueDataService } from '../../../../../@core/service/clue-service/clue-data.service';
import { ClueService } from '../../../../../@core/service/typescript-angular-client/api/clue.service';

import {CaseReviewService} from '../../../../../@core/service/case-review/case-review.service'
@Component({
  selector: 'app-previewdocument',
  templateUrl: './previewdocument.component.html',
  styleUrls: ['./previewdocument.component.scss']
})
export class PreviewdocumentComponent implements OnInit {
  favoriteColorControl = new FormControl('');
  public myDoc:any;
  public myflag:boolean;
  public list:any;
  public clueDoc:any;
  public registerDepartName:string;
  
  constructor(private route: ActivatedRoute,public router:Router,public clueData:ClueDataService,
    public clueService:ClueService,
    public caseReview:CaseReviewService) {
 }
  ngOnInit() {
    // this.list = this.clueData.myAarr[0];
    this.clueData.getDepart();
    var id = this.route.snapshot.params['id'];
    this.clueService.getClueById(id).subscribe(({data}:any)=>{
      this.list = data;
      this.clueDoc = data;
      this.list.address=JSON.parse(this.list.address)
      this.list.caseProvider=JSON.parse(this.list.caseProvider)
      this.registerDepartName = this.list.registerDepartName;
    })
  }



  dodoc(e){
    if(e){
      this.myDoc=e;
      this.myflag = true;
    }else{
      this.myflag = false;
    }
  }

  fun(ev){
    this.myflag = ev;
  }

  emitFather(){
    // this.loading= true
    // this.list.clueStatus = "02";
    // console.log(typeof(this.list.address))
    // this.list.address = JSON.stringify(this.list.address);
    // this.list.caseProvider = JSON.stringify(this.list.caseProvider);
    // this.clueService.updateClue(this.list).subscribe(data=>{
    //   this.loading = false;
    //   this.router.navigate(['/home/clue/cluedetail/',this.list.id]);
    // })
  }
}
